<template>
  <div class="myExamContainer">
      <div v-if="isShow" class="examItems" v-for="(item,index) in examInfo" :key="index" @click="toBeingExam(item.paperId)">
          <span>考试{{index+1}}名称：{{item.paperName}}</span>
          <span>答对题数/总题数：{{item.rightStems}}/{{item.total}}</span>
          <span>正确率：{{item.rightStems*100/item.total}}%</span>
          <span>总得分：{{item.rightStems*100/item.total}} 分</span>
      </div>
      <div v-if="!isShow">你还没有考试数据</div>
  </div>
</template>

<script>
import HttpKit from '@/utils/http-kit'
import globalStore from "../../stores/global-store";
export default {
  data () {
    return {
      examInfo: [],
      isShow: true
    }
  },
  methods: {
    toBeingExam(paperId){
      wx.navigateTo({
        url: '/pages/beingExam/main?paperId=' + paperId
      })
    }
    },
  onLoad (){
    this.examInfo = globalStore.state.examInfo
    console.log(this.examInfo)
    if(this.examInfo==null){
      this.isShow = false
    }
  }
}
</script>

<style scoped lang="less">
.myExamContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}
.examItems {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60%;
    padding: 10px 15px;
    border: 1px solid #669999;
    margin-bottom: 20px;
    border-radius: 8px;
  background-color: #66CCCC;
}
</style>
